<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">


            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-primary multiple disabled" onclick="$.operate.checkAll()" shiro:hasPermission="system:comment:edit">
                    <i class="fa fa-edit"></i> 审核
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:comment:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:comment:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:comment:remove')}]];
        var prefix = ctx + "system/comment";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                checkUrl: prefix + "/checkall",
                modalName: "【请填写功能名称】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'commentid',
                    title: '评论ID',
                    visible: false
                },
                {
                    field: 'docid',
                    title: '文档ID'
                },
                {
                    field: 'userid',
                    title: '用户ID'
                },
                {
                    field: 'comment',
                    title: '内容'
                },

                {
                    field: 'insertdate',
                    title: '时间'
                },
                {
                    title: '状态',
                    field: 'state',
                    formatter: function(value) {
                        var actions = [];
                        if(value>0)
                            actions.push('<span class="badge badge-primary">已审核</span>');
                        else
                            actions.push('<span class="badge badge-info">未审核</span>');
                        return actions.join('');
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.commentid + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>